package com.ytjj.qmyx.admin.eunm;

import com.ytjj.qmyx.admin.model.response.PromotePlatformResponse;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * 
 * @Version: 1.0
 */
public enum PromotePlatformEnums {

	TT("tt", "头条"),
	DY("dy", "抖音"),
	KS("ks", "快手"),
	GDT("gdt", "广点通"),
	PYQ("pyq", "朋友圈"),
	ZH("zh", "知乎"),
	XHS("xhs", "小红书"),
	SMS("sms", "推广"),
	VIVO("vivo", "VIVO"),
	OPPO("oppo", "OPPO"),
	TUIA("tuia", "推啊"),
	XGT("xgt", "效果通"),
	WY("wy", "网易"),
	GIONEE("gionee", "金立"),
	BILI("bili", "哔哩哔哩"),
	ZHPLUS("zhplus", "知乎+"),
	TTKA("ttka", "头条KA"),
	UCB("ucb", "UC浏览器");

	private String code;

	private String name;

	PromotePlatformEnums(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	/**
	 * 根据枚举code获取名称
	 * @param code
	 * @return
	 */
	public static String getName(String code){
		PromotePlatformEnums[] list = PromotePlatformEnums.values();
		for (PromotePlatformEnums item : list) {
			if (item.getCode().equals(code)) {
				return item.getName();
			}
		}
		return null;
	}

	public static List<PromotePlatformResponse> getplatList() {
		List<PromotePlatformResponse> list = new ArrayList<>();
		PromotePlatformEnums[] platList = PromotePlatformEnums.values();
		for (PromotePlatformEnums plat : platList) {
			PromotePlatformResponse atp = new PromotePlatformResponse();
			atp.setPlatCode(plat.getCode());
			atp.setPlatName(plat.getName());
			list.add(atp);
		}
		return list;
	}

}
